import Vue from 'vue'
import Element, { Message } from 'element-ui'
import IEVersion from '@/common/ie'

if (process.browser) {
  if (IEVersion() === 9) {
    // ie9下，处理table宽度异常问题
    Element.Table.mixins.push({
      mounted() {
        setTimeout(() => {
          this.doLayout()
        })
      }
    })
  }
}

// Vue.use(Element)

if (process.browser) {
  window.alertError = (msg) => {
    Message.error(msg)
  }
}

import {
  Pagination,
  Dialog,
  Autocomplete,
  Dropdown,
  DropdownMenu,
  DropdownItem,

  Input,
  Radio,

  Checkbox,
  CheckboxButton,
  CheckboxGroup,
  Select,
  Option,
  Button,
  ButtonGroup,
  Table,
  TableColumn,
  DatePicker,
  Tooltip,
  Breadcrumb,
  BreadcrumbItem,
  Form,
  FormItem,
  Tabs,
  TabPane,
  Tag,


  Icon,
  Row,
  Col,


  Carousel,
  CarouselItem,

  MessageBox,

  Notification,
  Loading,
} from 'element-ui';

Vue.use(Pagination);
Vue.use(Dialog);
Vue.use(Autocomplete);
Vue.use(Dropdown);
Vue.use(DropdownMenu);
Vue.use(DropdownItem);

Vue.use(Input);

Vue.use(Radio);
Vue.use(Checkbox);
Vue.use(CheckboxButton);
Vue.use(CheckboxGroup);
Vue.use(Select);
Vue.use(Option);
Vue.use(Button);
Vue.use(ButtonGroup);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(DatePicker);

Vue.use(Tooltip);
Vue.use(Breadcrumb);
Vue.use(BreadcrumbItem);
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Tabs);
Vue.use(TabPane);
Vue.use(Tag);

Vue.use(Icon);
Vue.use(Row);
Vue.use(Col);


Vue.use(Carousel);
Vue.use(CarouselItem);
Vue.use(Loading.directive);

Vue.prototype.$loading = Loading.service
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$message = Message;
Vue.prototype.$alert = MessageBox.alert;
